#include "fxcc/yml/Serializer.h"
#include "fxcc/core/MetaCache.h"

template<>
void fxcc::yml::Serializer::Encode<MetaMapIndex>(YAML::Node& node, const MetaMapIndex& inst)
{
	SetVariable<std::string>(node, "m_NativeFile", inst.m_NativeFile);
	SetVariable<std::string>(node, "m_TargetFile", inst.m_TargetFile);
	SetVariable<std::string>(node, "m_TargetDir", inst.m_TargetDir);
	SetVariable<std::string>(node, "m_TargetFilePath", inst.m_TargetFilePath);
	SetVariable<std::string>(node, "m_GUID", inst.m_GUID);
	SetVariable<std::string>(node, "m_FileId", inst.m_FileId);
	SetVariable<std::string>(node, "m_Seed", inst.m_Seed);
	SetVariable<std::string>(node, "m_Name", inst.m_Name);
}


template<>
bool fxcc::yml::Serializer::Decode<MetaMapIndex>(const YAML::Node& node, MetaMapIndex& inst)
{
	GetVariable<std::string>(node, "m_NativeFile", inst.m_NativeFile);
	GetVariable<std::string>(node, "m_TargetFile", inst.m_TargetFile);
	GetVariable<std::string>(node, "m_TargetDir", inst.m_TargetDir);
	GetVariable<std::string>(node, "m_TargetFilePath", inst.m_TargetFilePath);
	GetVariable<std::string>(node, "m_GUID", inst.m_GUID);
	GetVariable<std::string>(node, "m_FileId", inst.m_FileId);
	GetVariable<std::string>(node, "m_Seed", inst.m_Seed);
	GetVariable<std::string>(node, "m_Name", inst.m_Name);
	return true;
}

template<>
void fxcc::yml::Serializer::Encode<MetaCache>(YAML::Node& node, const MetaCache& inst)
{
	SetArrayVariable<MetaMapIndex>(node, "m_MetaMapIndexes", inst.m_MetaMapIndexes);
}


template<>
bool fxcc::yml::Serializer::Decode<MetaCache>(const YAML::Node& node, MetaCache& inst)
{
	GetArrayVariable<MetaMapIndex>(node, "m_MetaMapIndexes", inst.m_MetaMapIndexes);
	return true;
}